package database;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import model.Entidade;

public abstract class DAOClass {
	public abstract Entidade getById(int id);
	public abstract <T> boolean inserir(T t);
	
	public ResultSet getByStringField(String tabela,String campo, String valor){
		try{
			Connection conn = Conexao.getConexao();
			PreparedStatement pstm = conn.prepareStatement("Select * from " + tabela + " where " + campo + " = ?");
			pstm.setString(1, valor);
			
			ResultSet rs = pstm.executeQuery();
			
			return rs;
		}
		catch(Exception e){
			e.printStackTrace();
		}
		return null;
	}
}
